fib_sequence = []

num_str = input("请输入一个正整数：")

try:
    num = int(num_str)
    if num > 0:
        if num == 1:
            fib_sequence = [0]
        elif num == 2:
            fib_sequence = [0, 1]
        else:
            fib_sequence = [0, 1]
            for i in range(2, num):
                next_value = fib_sequence[i - 1] + fib_sequence[i - 2]
                fib_sequence.append(next_value)
        print(f"前{num}个斐波那契数列为：{fib_sequence}")
    else:
        print("输入不合法，请输入一个大于0的整数")
except ValueError:
    print("输入不合法，请输入一个有效的整数")